<template>
	<view class="tutor-manage">
		<view class="tutor-manage-content">
			<!-- 教练列表 -->
			<view class="tutorList" :style="[{ height:'calc(100vh - 120px )'}]">
				<z-paging ref="paging" :fixed="false" v-model="listData" @query="queryList">


					<tutor-tutorStatusCard @TotutorDetails="TotutorDetails" :isHideButton="0" :ossUrl="ossUrl"
						:tutorList="listData"></tutor-tutorStatusCard>

				</z-paging>
			</view>
		</view>
		<!-- 添加教练 -->
		<tui-fab @click="addTutor" :right="26" :bottom="252" custom bgColor="transparent" width="124" height="150">
			<image src="/static/user/icon_addzhujiao@2x.png" style="width: 100%;height: 100%;"></image>
		</tui-fab>
	</view>
</template>

<script>
	import {
		getTutorListByMerchant
	} from "@/http/api/tutor/tutor.js"
	export default {
		data() {
			return {
				listData: [],
			}
		},
		props: {
			marginTp: {
				type: Number,
				default: 0
			},
			//oss
			ossUrl: {
				type: String,
				default: ''
			}
		},
		computed: {
			merchantId() {
				return this.$store.state.userShopDetails.id
			}
		},
		destroyed() {
			uni.$off('tutorShopRefresh')
		},
		mounted() {
			uni.$on('tutorShopRefresh', () => {
				this.$refs.paging.reload()
			})
		},
		methods: {
			TotutorDetails(item) {
				uni.navigateTo({
					url: '/pages/tutorControl/modules/tutorList/tutorList?id=' + item.id
				})
			},
			//进入添加教练页面
			addTutor() {
				uni.navigateTo({
					url: '/pages/tutorControl/modules/userInfoEdit/userInfoEdit?isAdd=' + true + '&merchantId=' +
						this.merchantId
				})
			},
			//加载教练列表
			queryList(pageNo, pageSize) {
				getTutorListByMerchant({
					pageNum: pageNo,
					pageSize,
					merchantId: this.merchantId
				}).then(res => {
					if (res.code == 200) {
						this.$refs.paging.complete(res.rows);
					} else {
						self.$utils.toast(res.msg);
					}
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.tutor-manage {
		background-color: #F5F5F5;
		// height: auto;
		width: 100vw;

		.tui-header-icon {
			width: 100%;
			position: fixed;
			top: 0;
			padding: 0 0 0 38rpx;
			display: flex;
			align-items: center;
			height: 32px;
			transform: translateZ(0);
			z-index: 99999;
			box-sizing: border-box;
		}

		.tutor-manage-content {
			// padding-top: 100rpx;
		
			// padding-bottom: 100rpx;

			.tutorList {
				width: 94%;
				margin: 0 auto;

				box-sizing: border-box;
			}
		}
	}
</style>